// miniprogram/pages/list/index.js.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    todoList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getTodoList();
  },
  getTodoList:function(){
    wx.cloud.callFunction({
      name: 'todoList',
      complete: res => {
        this.setData({todoList:res.result.data})
      }
    })
  },
  toDetial:function(e){
    let todoid =e.currentTarget.dataset.todoid;
    if(!todoid){
      wx.showToast({
        title: '获取信息失败',
        icon: 'none',
        duration: 2000
      })
      return ;
    }
    wx.navigateTo({
      url: './detial?todoid='+todoid,
    })
  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})